package com.neusoft.ruangong.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neusoft.ruangong.domain.Room;
import com.neusoft.ruangong.mapper.RoomMapper;
import com.neusoft.ruangong.service.RoomService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.List;
@Service
public class RoomServiceImpl extends ServiceImpl<RoomMapper,Room> implements RoomService {
    @Resource
    RoomMapper roomMapper;
    @Override
    public Integer addRoom(Room room) {
        return roomMapper.insert(room);
    }

    @Override
    public Integer removeRoom(Long id) {
        return roomMapper.deleteById(id);
    }

    @Override
    public Integer modifyRoom(Room room) {
        return roomMapper.updateById(room);
    }

    @Override
    public List<Room> queryRooms() {
        return roomMapper.selectList(null);
    }

    @Override
    public long queryRoomId(String roomName) {
        return roomMapper.queryRoomId(roomName);
    }

    @Override
    public Room queryRoomById(BigInteger id) {
        return roomMapper.selectById(id);
    }

    @Override
    public List<Room> linkQueryRooms(String str) {
        List<Room> list = roomMapper.linkSelectRoom(str);
        return list;
    }
}
